package library;

import java.util.Set;
import java.util.TreeSet;


class Book
	extends Item
{
	private String title;
	private String author;
	private int nPages;
	private Set<String> keywords;
	
	public Book(String title, String author, int nPages, String... keywords){
		this.title = title;
		this.author = author;
		this.nPages = nPages;
		this.keywords = new TreeSet<String>();
		this.keywords.clear();
		for(String s : keywords){
			this.keywords.add(s);
		}
	}
	
	public String getTitle(){
		return this.title;
	}
	
	public String getCreator(){
		return this.author;
	}
	
	public Set<String> getKeyword() {
		return this.keywords;
	}
	
	public String toString(){
		String result;
		result = "-Book-\r\n";
		result += "author:   " + this.author + "\r\n# pages:  " + this.nPages + "\r\ntitle:    " +
				this.title + "\r\nkeywords: ";
		boolean flag = false;
		for(String s: keywords){
			if (flag == false){
				result += s;
				flag = true;
			}
			else{
				result += ", " + s;
			}
		}
		result += "\r\n";
		return result;
	}

	
	public void add(String... M) {	
	}

	public Set<String> getGroup() {
		return null;
	}

}
